<cfcomponent displayname="Kalendar" output="false">
		<cfproperty name="EventID" type="string" default="" />
		<cfproperty name="CategoryID" type="numeric" default="" />
		<cfproperty name="IsDeleted" type="boolean" default="" />
		<cfproperty name="IsPublic" type="boolean" default="" />
		<cfproperty name="IsFeatured" type="boolean" default="" />
		<cfproperty name="DateTimeCreated" type="date" default="" />
		<cfproperty name="StartDate" type="date" default="" />
		<cfproperty name="EndDate" type="date" default="" />
		<cfproperty name="StartTime" type="string" default="" />
		<cfproperty name="EndTime" type="string" default="" />
		<cfproperty name="ContactPhone" type="string" default="" />
		<cfproperty name="ContactName" type="string" default="" />
		<cfproperty name="ContactEmail" type="string" default="" />
		<cfproperty name="Title" type="string" default="" />
		<cfproperty name="Location" type="string" default="" />
		<cfproperty name="Teaser" type="string" default="" />
		<cfproperty name="ExternalURL" type="string" default="" />
		<cfproperty name="Description" type="string" default="" />
		
	<!---
	PROPERTIES
	--->
	<cfset variables.instance = StructNew() />

	<!---
	INITIALIZATION / CONFIGURATION
	--->
	<cffunction name="init" access="public" returntype="KalendarBean" output="false">
		<cfargument name="EventID" type="string" required="false" default="" />
		<cfargument name="CategoryID" type="string" required="false" default="" />
		<cfargument name="IsDeleted" type="string" required="false" default="" />
		<cfargument name="IsPublic" type="string" required="false" default="" />
		<cfargument name="IsFeatured" type="string" required="false" default="" />
		<cfargument name="DateTimeCreated" type="string" required="false" default="" />
		<cfargument name="StartDate" type="string" required="false" default="" />
		<cfargument name="EndDate" type="string" required="false" default="" />
		<cfargument name="StartTime" type="string" required="false" default="" />
		<cfargument name="EndTime" type="string" required="false" default="" />
		<cfargument name="ContactPhone" type="string" required="false" default="" />
		<cfargument name="ContactName" type="string" required="false" default="" />
		<cfargument name="ContactEmail" type="string" required="false" default="" />
		<cfargument name="Title" type="string" required="false" default="" />
		<cfargument name="Location" type="string" required="false" default="" />
		<cfargument name="Teaser" type="string" required="false" default="" />
		<cfargument name="ExternalURL" type="string" required="false" default="" />
		<cfargument name="Description" type="string" required="false" default="" />
		
		<!--- run setters --->
		<cfset setEventID(arguments.EventID) />
		<cfset setCategoryID(arguments.CategoryID) />
		<cfset setIsDeleted(arguments.IsDeleted) />
		<cfset setIsPublic(arguments.IsPublic) />
		<cfset setIsFeatured(arguments.IsFeatured) />
		<cfset setDateTimeCreated(arguments.DateTimeCreated) />
		<cfset setStartDate(arguments.StartDate) />
		<cfset setEndDate(arguments.EndDate) />
		<cfset setStartTime(TimeFormat(arguments.StartDate)) />
		<cfset setEndTime(TimeFormat(arguments.EndTime)) />
		<cfset setContactPhone(arguments.ContactPhone) />
		<cfset setContactName(arguments.ContactName) />
		<cfset setContactEmail(arguments.ContactEmail) />
		<cfset setTitle(arguments.Title) />
		<cfset setLocation(arguments.Location) />
		<cfset setTeaser(arguments.Teaser) />
		<cfset setExternalURL(arguments.ExternalURL) />
		<cfset setDescription(arguments.Description) />
		
		<cfreturn this />
 	</cffunction>

	<!---
	PUBLIC FUNCTIONS
	--->
	<cffunction name="setMemento" access="public" returntype="KalendarBean" output="false">
		<cfargument name="memento" type="struct" required="yes"/>
		<cfset variables.instance = arguments.memento />
		<cfreturn this />
	</cffunction>
	<cffunction name="getMemento" access="public" returntype="struct" output="false" >
		<cfreturn variables.instance />
	</cffunction>

	<cffunction name="validate" access="public" returntype="array" output="false">
		<cfset var errors = arrayNew(1) />
		<cfset var thisError = structNew() />
		
		<!--- EventID --->
		<cfif (NOT len(trim(getEventID())))>
			<cfset thisError.field = "EventID" />
			<cfset thisError.type = "required" />
			<cfset thisError.message = "EventID is required" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getEventID())) AND NOT IsSimpleValue(trim(getEventID())))>
			<cfset thisError.field = "EventID" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "EventID is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getEventID())) GT 100)>
			<cfset thisError.field = "EventID" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "EventID is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- CategoryID --->
		<cfif (NOT len(trim(getCategoryID())))>
			<cfset thisError.field = "CategoryID" />
			<cfset thisError.type = "required" />
			<cfset thisError.message = "CategoryID is required" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getCategoryID())) AND NOT isNumeric(trim(getCategoryID())))>
			<cfset thisError.field = "CategoryID" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "CategoryID is not numeric" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- IsDeleted --->
		<cfif (len(trim(getIsDeleted())) AND NOT isBoolean(trim(getIsDeleted())))>
			<cfset thisError.field = "IsDeleted" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "IsDeleted is not boolean" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- IsPublic --->
		<cfif (len(trim(getIsPublic())) AND NOT isBoolean(trim(getIsPublic())))>
			<cfset thisError.field = "IsPublic" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "IsPublic is not boolean" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- IsFeatured --->
		<cfif (len(trim(getIsFeatured())) AND NOT isBoolean(trim(getIsFeatured())))>
			<cfset thisError.field = "IsFeatured" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "IsFeatured is not boolean" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- DateTimeCreated --->
		<cfif (len(trim(getDateTimeCreated())) AND NOT isDate(trim(getDateTimeCreated())))>
			<cfset thisError.field = "DateTimeCreated" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "DateTimeCreated is not a date" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- StartDate --->
		<cfif (NOT len(trim(getStartDate())))>
			<cfset thisError.field = "StartDate" />
			<cfset thisError.type = "required" />
			<cfset thisError.message = "StartDate is required" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getStartDate())) AND NOT isDate(trim(getStartDate())))>
			<cfset thisError.field = "StartDate" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "StartDate is not a date" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- EndDate --->
		<cfif (NOT len(trim(getEndDate())))>
			<cfset thisError.field = "EndDate" />
			<cfset thisError.type = "required" />
			<cfset thisError.message = "EndDate is required" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getEndDate())) AND NOT isDate(trim(getEndDate())))>
			<cfset thisError.field = "EndDate" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "EndDate is not a date" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- StartTime --->
		<cfif (len(trim(getStartDate())) AND NOT IsSimpleValue(trim(getStartDate())))>
			<cfset thisError.field = "StartTime" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "StartTime is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getStartDate())) GT 50)>
			<cfset thisError.field = "StartTime" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "StartTime is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- EndTime --->
		<cfif (len(trim(getEndDate())) AND NOT IsSimpleValue(trim(getEndDate())))>
			<cfset thisError.field = "EndTime" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "EndTime is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getEndDate())) GT 50)>
			<cfset thisError.field = "EndTime" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "EndTime is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- ContactPhone --->
		<cfif (len(trim(getContactPhone())) AND NOT IsSimpleValue(trim(getContactPhone())))>
			<cfset thisError.field = "ContactPhone" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "ContactPhone is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getContactPhone())) GT 50)>
			<cfset thisError.field = "ContactPhone" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "ContactPhone is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- ContactName --->
		<cfif (len(trim(getContactName())) AND NOT IsSimpleValue(trim(getContactName())))>
			<cfset thisError.field = "ContactName" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "ContactName is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getContactName())) GT 100)>
			<cfset thisError.field = "ContactName" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "ContactName is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- ContactEmail --->
		<cfif (len(trim(getContactEmail())) AND NOT IsSimpleValue(trim(getContactEmail())))>
			<cfset thisError.field = "ContactEmail" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "ContactEmail is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getContactEmail())) GT 50)>
			<cfset thisError.field = "ContactEmail" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "ContactEmail is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- Title --->
		<cfif (NOT len(trim(getTitle())))>
			<cfset thisError.field = "Title" />
			<cfset thisError.type = "required" />
			<cfset thisError.message = "Title is required" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getTitle())) AND NOT IsSimpleValue(trim(getTitle())))>
			<cfset thisError.field = "Title" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "Title is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getTitle())) GT 150)>
			<cfset thisError.field = "Title" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "Title is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- Location --->
		<cfif (len(trim(getLocation())) AND NOT IsSimpleValue(trim(getLocation())))>
			<cfset thisError.field = "Location" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "Location is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getLocation())) GT 150)>
			<cfset thisError.field = "Location" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "Location is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- Teaser --->
		<cfif (len(trim(getTeaser())) AND NOT IsSimpleValue(trim(getTeaser())))>
			<cfset thisError.field = "Teaser" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "Teaser is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getTeaser())) GT 350)>
			<cfset thisError.field = "Teaser" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "Teaser is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- ExternalURL --->
		<cfif (len(trim(getExternalURL())) AND NOT IsSimpleValue(trim(getExternalURL())))>
			<cfset thisError.field = "ExternalURL" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "ExternalURL is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getExternalURL())) GT 500)>
			<cfset thisError.field = "ExternalURL" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "ExternalURL is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<!--- Description --->
		<cfif (NOT len(trim(getDescription())))>
			<cfset thisError.field = "Description" />
			<cfset thisError.type = "required" />
			<cfset thisError.message = "Description is required" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getDescription())) AND NOT IsSimpleValue(trim(getDescription())))>
			<cfset thisError.field = "Description" />
			<cfset thisError.type = "invalidType" />
			<cfset thisError.message = "Description is not a string" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		<cfif (len(trim(getDescription())) GT 2147483647)>
			<cfset thisError.field = "Description" />
			<cfset thisError.type = "tooLong" />
			<cfset thisError.message = "Description is too long" />
			<cfset arrayAppend(errors,duplicate(thisError)) />
		</cfif>
		
		<cfreturn errors />
	</cffunction>

	<!---
	ACCESSORS
	--->
	<cffunction name="setEventID" access="public" returntype="void" output="false">
		<cfargument name="EventID" type="string" required="true" />
		<cfset variables.instance.EventID = arguments.EventID />
	</cffunction>
	<cffunction name="getEventID" access="public" returntype="string" output="false">
		<cfreturn variables.instance.EventID />
	</cffunction>

	<cffunction name="setCategoryID" access="public" returntype="void" output="false">
		<cfargument name="CategoryID" type="string" required="true" />
		<cfset variables.instance.CategoryID = arguments.CategoryID />
	</cffunction>
	<cffunction name="getCategoryID" access="public" returntype="string" output="false">
		<cfreturn variables.instance.CategoryID />
	</cffunction>

	<cffunction name="setIsDeleted" access="public" returntype="void" output="false">
		<cfargument name="IsDeleted" type="string" required="true" />
		<cfset variables.instance.IsDeleted = arguments.IsDeleted />
	</cffunction>
	<cffunction name="getIsDeleted" access="public" returntype="string" output="false">
		<cfreturn variables.instance.IsDeleted />
	</cffunction>

	<cffunction name="setIsPublic" access="public" returntype="void" output="false">
		<cfargument name="IsPublic" type="string" required="true" />
		<cfset variables.instance.IsPublic = arguments.IsPublic />
	</cffunction>
	<cffunction name="getIsPublic" access="public" returntype="string" output="false">
		<cfreturn variables.instance.IsPublic />
	</cffunction>

	<cffunction name="setIsFeatured" access="public" returntype="void" output="false">
		<cfargument name="IsFeatured" type="string" required="true" />
		<cfset variables.instance.IsFeatured = arguments.IsFeatured />
	</cffunction>
	<cffunction name="getIsFeatured" access="public" returntype="string" output="false">
		<cfreturn variables.instance.IsFeatured />
	</cffunction>

	<cffunction name="setDateTimeCreated" access="public" returntype="void" output="false">
		<cfargument name="DateTimeCreated" type="string" required="true" />
		<cfset variables.instance.DateTimeCreated = arguments.DateTimeCreated />
	</cffunction>
	<cffunction name="getDateTimeCreated" access="public" returntype="string" output="false">
		<cfreturn variables.instance.DateTimeCreated />
	</cffunction>

	<cffunction name="setStartDate" access="public" returntype="void" output="false">
		<cfargument name="StartDate" type="string" required="true" />
		<cfset variables.instance.StartDate = arguments.StartDate />
	</cffunction>
	<cffunction name="getStartDate" access="public" returntype="string" output="false">
		<cfreturn variables.instance.StartDate />
	</cffunction>

	<cffunction name="setEndDate" access="public" returntype="void" output="false">
		<cfargument name="EndDate" type="string" required="true" />
		<cfset variables.instance.EndDate = arguments.EndDate />
	</cffunction>
	<cffunction name="getEndDate" access="public" returntype="string" output="false">
		<cfreturn variables.instance.EndDate />
	</cffunction>

	<cffunction name="setStartTime" access="public" returntype="void" output="false">
		<cfargument name="StartTime" type="string" required="true" />
		<cfset variables.instance.StartTime = arguments.StartTime />
	</cffunction>
	<cffunction name="getStartDate" access="public" returntype="string" output="false">
		<cfreturn variables.instance.StartTime />
	</cffunction>

	<cffunction name="setEndTime" access="public" returntype="void" output="false">
		<cfargument name="EndTime" type="string" required="true" />
		<cfset variables.instance.EndTime = arguments.EndTime />
	</cffunction>
	<cffunction name="getEndDate" access="public" returntype="string" output="false">
		<cfreturn variables.instance.EndTime />
	</cffunction>

	<cffunction name="setContactPhone" access="public" returntype="void" output="false">
		<cfargument name="ContactPhone" type="string" required="true" />
		<cfset variables.instance.ContactPhone = arguments.ContactPhone />
	</cffunction>
	<cffunction name="getContactPhone" access="public" returntype="string" output="false">
		<cfreturn variables.instance.ContactPhone />
	</cffunction>

	<cffunction name="setContactName" access="public" returntype="void" output="false">
		<cfargument name="ContactName" type="string" required="true" />
		<cfset variables.instance.ContactName = arguments.ContactName />
	</cffunction>
	<cffunction name="getContactName" access="public" returntype="string" output="false">
		<cfreturn variables.instance.ContactName />
	</cffunction>

	<cffunction name="setContactEmail" access="public" returntype="void" output="false">
		<cfargument name="ContactEmail" type="string" required="true" />
		<cfset variables.instance.ContactEmail = arguments.ContactEmail />
	</cffunction>
	<cffunction name="getContactEmail" access="public" returntype="string" output="false">
		<cfreturn variables.instance.ContactEmail />
	</cffunction>

	<cffunction name="setTitle" access="public" returntype="void" output="false">
		<cfargument name="Title" type="string" required="true" />
		<cfset variables.instance.Title = arguments.Title />
	</cffunction>
	<cffunction name="getTitle" access="public" returntype="string" output="false">
		<cfreturn variables.instance.Title />
	</cffunction>

	<cffunction name="setLocation" access="public" returntype="void" output="false">
		<cfargument name="Location" type="string" required="true" />
		<cfset variables.instance.Location = arguments.Location />
	</cffunction>
	<cffunction name="getLocation" access="public" returntype="string" output="false">
		<cfreturn variables.instance.Location />
	</cffunction>

	<cffunction name="setTeaser" access="public" returntype="void" output="false">
		<cfargument name="Teaser" type="string" required="true" />
		<cfset variables.instance.Teaser = arguments.Teaser />
	</cffunction>
	<cffunction name="getTeaser" access="public" returntype="string" output="false">
		<cfreturn variables.instance.Teaser />
	</cffunction>

	<cffunction name="setExternalURL" access="public" returntype="void" output="false">
		<cfargument name="ExternalURL" type="string" required="true" />
		<cfset variables.instance.ExternalURL = arguments.ExternalURL />
	</cffunction>
	<cffunction name="getExternalURL" access="public" returntype="string" output="false">
		<cfreturn variables.instance.ExternalURL />
	</cffunction>

	<cffunction name="setDescription" access="public" returntype="void" output="false">
		<cfargument name="Description" type="string" required="true" />
		<cfset variables.instance.Description = arguments.Description />
	</cffunction>
	<cffunction name="getDescription" access="public" returntype="string" output="false">
		<cfreturn variables.instance.Description />
	</cffunction>


	<!---
	DUMP
	--->
	<cffunction name="dump" access="public" output="true" return="void">
		<cfargument name="abort" type="boolean" default="false" />
		<cfdump var="#variables.instance#" />
		<cfif arguments.abort>
			<cfabort />
		</cfif>
	</cffunction>

</cfcomponent>